package com.fujica.invoicing.controller;

import com.fujica.invoicing.request.purchase.PurchaseReq;
import com.fujica.invoicing.service.IPurchaseService;
import com.fujica.invoicing.utils.Result;
import com.fujica.invoicing.utils.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName PurchaseController
 * @Description TODO  进货操作
 * @Author admin
 * @Date 2020/8/11 17:02
 * @Version 1.0
 **/

@RestController
@RequestMapping("invoicing/purchase")
@Api(tags = "进货")
public class PurchaseController {

    @Autowired
    private IPurchaseService iPurchaseService;

    @PostMapping
    @ApiOperation(value = "进货", notes = "进货")
    public Result purchase(@RequestBody PurchaseReq req){
        if (req.getDepositoryId() > 0) {
            return iPurchaseService.purchase(req);
        }
        return ResultBody.badReq("参数错误");
    }

}
